﻿// PassWordPane.cpp: 实现文件
//

#include "stdafx.h"
#include "Hsvcs.h"
#include "PassWordPane.h"
#include "afxdialogex.h"


// CPassWordPane 对话框

IMPLEMENT_DYNAMIC(CPassWordPane, CDialogEx)

CPassWordPane::CPassWordPane(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG_PASSWORD, pParent)
{
}

CPassWordPane::~CPassWordPane()
{
}

const CString CPassWordPane::GetPassWord()
{
	return m_szPassword;
}

void CPassWordPane::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CPassWordPane, CDialogEx)
	ON_BN_CLICKED(IDOK, &CPassWordPane::OnBnClickedOk)
	ON_BN_CLICKED(IDCANCEL, &CPassWordPane::OnBnClickedCancel)
END_MESSAGE_MAP()


// CPassWordPane 消息处理程序


BOOL CPassWordPane::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	TCHAR ch = '*';
	((CEdit*)GetDlgItem(IDC_EDIT_PASSWORD))->SetPasswordChar(ch);
	((CEdit*)GetDlgItem(IDC_EDIT_PASSWORD))->SetFocus();
	return FALSE;
}

void CPassWordPane::OnBnClickedOk()
{
	// 获取输入框文本
	GetDlgItemText(IDC_EDIT_PASSWORD, m_szPassword);
	//DestroyWindow();
	//CloseWindow();
	CDialogEx::OnOK();
}


void CPassWordPane::OnBnClickedCancel()
{
	m_szPassword = L"";
	//DestroyWindow();
	//CloseWindow();
	CDialogEx::OnCancel();
}
